package com.jy.modules.cims.common;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import com.jy.modules.cims.interact.InteractClient;

/**
 * spring统一异常处理类
 * <b>类名称：</b>CustomizedHandlerExceptionResolver <br/>
 * <b>类描述：</b><br/>
 * <b>创建人：</b>chenguixue<br/>
 * <b>修改人：</b><br/>
 * <b>修改时间：</b>2015-3-28 下午4:56:34<br/>
 * <b>修改备注：</b><br/>
 * <b>版本信息：</b>v1.0.0<br/>
 */
public class CustomizedHandlerExceptionResolver implements HandlerExceptionResolver {
	private static final Logger logger =  LoggerFactory.getLogger(CustomizedHandlerExceptionResolver.class);

	@Override
	public ModelAndView resolveException(HttpServletRequest arg0,
			HttpServletResponse arg1, Object arg2, Exception arg3) {
		// TODO Auto-generated method stub
		logger.error("统一异常处理类捕获异常", arg3);
		ModelAndView model = new ModelAndView();
		model.setViewName("error");
		model.addObject("detail", arg3.getMessage());
		return model; 
	}
}
